package com.prueba.server.persistence;

import java.net.UnknownHostException;

import com.mongodb.*;

public class EntityManager {

	protected Mongo mongo;
	protected DBCollection collection;
	protected DBCollection collectionId;
	protected DB db;
	
	
	public EntityManager(String collection) {
		
		try {
			
			this.mongo = new Mongo();
			
		
		} catch (UnknownHostException e) {
			
			e.printStackTrace();
			System.out.println("Error en la base de datos: "+e);
		} catch (MongoException e) {
			
			e.printStackTrace();
			System.out.println("Error en la base de datos: "+e);
		}
		
		this.db = this.mongo.getDB("prueba");
		this.collection = db.getCollection(collection);
		this.collectionId = db.getCollection("ids");
		
		
	}
	
	
	
}
